using UnityEngine;

namespace Coffee.UIExtensions
{
    // [Assembly-CSharp.dll].Coffee.UIExtensions.UIShiny
    public class UIShiny : UIEffectBase
    {
        // Fields
        public const string shaderName = "UI/Hidden/UI-Effect-Shiny";
        private static readonly Coffee.UIExtensions.ParameterTexture _ptex;
        private float m_EffectFactor;
        private float m_Width;
        private float m_Rotation;
        private float m_Softness;
        private float m_Brightness;
        private float m_Gloss;
        protected Coffee.UIExtensions.EffectArea m_EffectArea;
        private Coffee.UIExtensions.EffectPlayer m_Player;
        private bool m_Play;
        private bool m_Loop;
        private float m_Duration;
        private float m_LoopDelay;
        private UnityEngine.AnimatorUpdateMode m_UpdateMode;
        private float _lastRotation;
        
        // Properties
        public float location { get; set; }
        public float effectFactor { get; set; }
        public float width { get; set; }
        public float softness { get; set; }
        public float alpha { get; set; }
        public float brightness { get; set; }
        public float highlight { get; set; }
        public float gloss { get; set; }
        public float rotation { get; set; }
        public Coffee.UIExtensions.EffectArea effectArea { get; set; }
        public bool play { get; set; }
        public bool loop { get; set; }
        public float duration { get; set; }
        public float loopDelay { get; set; }
        public UnityEngine.AnimatorUpdateMode updateMode { get; set; }
        public override Coffee.UIExtensions.ParameterTexture ptex { get; }
        private Coffee.UIExtensions.EffectPlayer _player { get; }
        
        // Methods
        public float get_location()
        {
            return (float)this.m_EffectFactor;
        }
        public void set_location(float value)
        {
            double val_10;
            float val_1 = (value >= 0) ? 1f : 0f;
            float val_10 = System.Math.Abs(this.m_EffectFactor);
            float val_11 = System.Math.Abs(val_1);
            float val_12 = 1E-06f;
            val_12 = ((val_10 > val_11) ? (val_10) : (val_11)) * val_12;
            float val_13 = 8f;
            val_13 = mem[536889545] * val_13;
            float val_4 = (val_12 > val_13) ? (val_12) : (val_13);
            if((val_1 ?? this.m_EffectFactor) < 0)
            {
                    return;
            }
            
            this.m_EffectFactor = val_1;
            val_10 = ???;
            goto typeof(Coffee.UIExtensions.UIShiny).__il2cppRuntimeField_2D8;
        }
        public float get_effectFactor()
        {
            return (float)this.m_EffectFactor;
        }
        public void set_effectFactor(float value)
        {
            double val_10;
            float val_1 = (value >= 0) ? 1f : 0f;
            float val_10 = System.Math.Abs(this.m_EffectFactor);
            float val_11 = System.Math.Abs(val_1);
            float val_12 = 1E-06f;
            val_12 = ((val_10 > val_11) ? (val_10) : (val_11)) * val_12;
            float val_13 = 8f;
            val_13 = mem[536889545] * val_13;
            float val_4 = (val_12 > val_13) ? (val_12) : (val_13);
            if((val_1 ?? this.m_EffectFactor) < 0)
            {
                    return;
            }
            
            this.m_EffectFactor = val_1;
            val_10 = ???;
            goto typeof(Coffee.UIExtensions.UIShiny).__il2cppRuntimeField_2D8;
        }
        public float get_width()
        {
            return (float)this.m_Width;
        }
        public void set_width(float value)
        {
            double val_10;
            float val_1 = (value >= 0) ? 1f : 0f;
            float val_10 = System.Math.Abs(this.m_Width);
            float val_11 = System.Math.Abs(val_1);
            float val_12 = 1E-06f;
            val_12 = ((val_10 > val_11) ? (val_10) : (val_11)) * val_12;
            float val_13 = 8f;
            val_13 = mem[536889545] * val_13;
            float val_4 = (val_12 > val_13) ? (val_12) : (val_13);
            if((val_1 ?? this.m_Width) < 0)
            {
                    return;
            }
            
            this.m_Width = val_1;
            val_10 = ???;
            goto typeof(Coffee.UIExtensions.UIShiny).__il2cppRuntimeField_2D8;
        }
        public float get_softness()
        {
            return (float)this.m_Softness;
        }
        public void set_softness(float value)
        {
            double val_10;
            float val_1 = (value >= 0) ? 1f : 0.01f;
            float val_10 = System.Math.Abs(this.m_Softness);
            float val_11 = System.Math.Abs(val_1);
            float val_12 = 1E-06f;
            val_12 = ((val_10 > val_11) ? (val_10) : (val_11)) * val_12;
            float val_13 = 8f;
            val_13 = mem[536889545] * val_13;
            float val_4 = (val_12 > val_13) ? (val_12) : (val_13);
            if((val_1 ?? this.m_Softness) < 0)
            {
                    return;
            }
            
            this.m_Softness = val_1;
            val_10 = ???;
            goto typeof(Coffee.UIExtensions.UIShiny).__il2cppRuntimeField_2D8;
        }
        public float get_alpha()
        {
            return (float)this.m_Brightness;
        }
        public void set_alpha(float value)
        {
            double val_10;
            float val_1 = (value >= 0) ? 1f : 0f;
            float val_10 = System.Math.Abs(this.m_Brightness);
            float val_11 = System.Math.Abs(val_1);
            float val_12 = 1E-06f;
            val_12 = ((val_10 > val_11) ? (val_10) : (val_11)) * val_12;
            float val_13 = 8f;
            val_13 = mem[536889545] * val_13;
            float val_4 = (val_12 > val_13) ? (val_12) : (val_13);
            if((val_1 ?? this.m_Brightness) < 0)
            {
                    return;
            }
            
            this.m_Brightness = val_1;
            val_10 = ???;
            goto typeof(Coffee.UIExtensions.UIShiny).__il2cppRuntimeField_2D8;
        }
        public float get_brightness()
        {
            return (float)this.m_Brightness;
        }
        public void set_brightness(float value)
        {
            double val_10;
            float val_1 = (value >= 0) ? 1f : 0f;
            float val_10 = System.Math.Abs(this.m_Brightness);
            float val_11 = System.Math.Abs(val_1);
            float val_12 = 1E-06f;
            val_12 = ((val_10 > val_11) ? (val_10) : (val_11)) * val_12;
            float val_13 = 8f;
            val_13 = mem[536889545] * val_13;
            float val_4 = (val_12 > val_13) ? (val_12) : (val_13);
            if((val_1 ?? this.m_Brightness) < 0)
            {
                    return;
            }
            
            this.m_Brightness = val_1;
            val_10 = ???;
            goto typeof(Coffee.UIExtensions.UIShiny).__il2cppRuntimeField_2D8;
        }
        public float get_highlight()
        {
            return (float)this.m_Gloss;
        }
        public void set_highlight(float value)
        {
            double val_10;
            float val_1 = (value >= 0) ? 1f : 0f;
            float val_10 = System.Math.Abs(this.m_Gloss);
            float val_11 = System.Math.Abs(val_1);
            float val_12 = 1E-06f;
            val_12 = ((val_10 > val_11) ? (val_10) : (val_11)) * val_12;
            float val_13 = 8f;
            val_13 = mem[536889545] * val_13;
            float val_4 = (val_12 > val_13) ? (val_12) : (val_13);
            if((val_1 ?? this.m_Gloss) < 0)
            {
                    return;
            }
            
            this.m_Gloss = val_1;
            val_10 = ???;
            goto typeof(Coffee.UIExtensions.UIShiny).__il2cppRuntimeField_2D8;
        }
        public float get_gloss()
        {
            return (float)this.m_Gloss;
        }
        public void set_gloss(float value)
        {
            double val_10;
            float val_1 = (value >= 0) ? 1f : 0f;
            float val_10 = System.Math.Abs(this.m_Gloss);
            float val_11 = System.Math.Abs(val_1);
            float val_12 = 1E-06f;
            val_12 = ((val_10 > val_11) ? (val_10) : (val_11)) * val_12;
            float val_13 = 8f;
            val_13 = mem[536889545] * val_13;
            float val_4 = (val_12 > val_13) ? (val_12) : (val_13);
            if((val_1 ?? this.m_Gloss) < 0)
            {
                    return;
            }
            
            this.m_Gloss = val_1;
            val_10 = ???;
            goto typeof(Coffee.UIExtensions.UIShiny).__il2cppRuntimeField_2D8;
        }
        public float get_rotation()
        {
            return (float)this.m_Rotation;
        }
        public void set_rotation(float value)
        {
            float val_9 = value;
            float val_9 = System.Math.Abs(this.m_Rotation);
            float val_10 = System.Math.Abs(val_9 = value);
            float val_11 = 1E-06f;
            val_11 = ((val_9 > val_10) ? (val_9) : (val_10)) * val_11;
            float val_12 = 8f;
            val_12 = mem[536889545] * val_12;
            float val_3 = (val_11 > val_12) ? (val_11) : (val_12);
            if((val_9 ?? this.m_Rotation) < 0)
            {
                    return;
            }
            
            this.m_Rotation = val_9;
            val_9 = ???;
            goto typeof(Coffee.UIExtensions.UIShiny).__il2cppRuntimeField_2D8;
        }
        public Coffee.UIExtensions.EffectArea get_effectArea()
        {
            return (Coffee.UIExtensions.EffectArea)this.m_EffectArea;
        }
        public void set_effectArea(Coffee.UIExtensions.EffectArea value)
        {
            if(this.m_EffectArea == value)
            {
                    return;
            }
            
            this.m_EffectArea = value;
            goto typeof(Coffee.UIExtensions.UIShiny).__il2cppRuntimeField_2D8;
        }
        public bool get_play()
        {
            Coffee.UIExtensions.EffectPlayer val_1 = this._player;
            return (bool)val_1.play;
        }
        public void set_play(bool value)
        {
            Coffee.UIExtensions.EffectPlayer val_1 = this._player;
            val_1.play = value;
        }
        public bool get_loop()
        {
            Coffee.UIExtensions.EffectPlayer val_1 = this._player;
            return (bool)val_1.loop;
        }
        public void set_loop(bool value)
        {
            Coffee.UIExtensions.EffectPlayer val_1 = this._player;
            val_1.loop = value;
        }
        public float get_duration()
        {
            Coffee.UIExtensions.EffectPlayer val_1 = this._player;
            return (float)val_1.duration;
        }
        public void set_duration(float value)
        {
            Coffee.UIExtensions.EffectPlayer val_1 = this._player;
            val_1.duration = 0.1f;
        }
        public float get_loopDelay()
        {
            Coffee.UIExtensions.EffectPlayer val_1 = this._player;
            return (float)val_1.loopDelay;
        }
        public void set_loopDelay(float value)
        {
            Coffee.UIExtensions.EffectPlayer val_1 = this._player;
            val_1.loopDelay = 0f;
        }
        public UnityEngine.AnimatorUpdateMode get_updateMode()
        {
            Coffee.UIExtensions.EffectPlayer val_1 = this._player;
            return (UnityEngine.AnimatorUpdateMode)val_1.updateMode;
        }
        public void set_updateMode(UnityEngine.AnimatorUpdateMode value)
        {
            Coffee.UIExtensions.EffectPlayer val_1 = this._player;
            val_1.updateMode = value;
        }
        public override Coffee.UIExtensions.ParameterTexture get_ptex()
        {
            if(mem[536895095] != 0)
            {
                    return (Coffee.UIExtensions.ParameterTexture)mem[536895055];
            }
            
            536894871 = 536894871;
            return (Coffee.UIExtensions.ParameterTexture)mem[536895055];
        }
        protected override void OnEnable()
        {
            this.OnEnable();
            System.Action<System.Single> val_2 = 536873435;
            val_2 = new System.Action<System.Single>(object:  this, method:  1610679297);
            this._player.OnEnable(callback:  val_2);
        }
        protected override void OnDisable()
        {
            this.OnDisable();
            this._player.OnDisable();
        }
        public override void ModifyMesh(UnityEngine.UI.VertexHelper vh)
        {
            float val_5;
            float val_6;
            Coffee.UIExtensions.IParameterTexture val_19;
            UnityEngine.UI.Graphic val_20;
            float val_21;
            float val_22;
            var val_23;
            float val_24;
            val_19 = this;
            if(this.isActiveAndEnabled == false)
            {
                    return;
            }
            
            val_20 = this.graphic;
            UnityEngine.Rect val_4 = Coffee.UIExtensions.EffectAreaExtensions.GetEffectArea(area:  this.m_EffectArea, vh:  vh, graphic:  val_20, aspectRatio:  -1f);
            float val_19 = this.m_Rotation;
            val_19 = val_19 * 0.01745329f;
            float val_20 = val_4.m_XMin.height;
            float val_8 = val_4.m_XMin.width;
            val_20 = val_20 / val_8;
            val_20 = val_5 * val_20;
            val_8 = val_20 * val_20;
            val_8 = (val_6 * val_6) + val_8;
            if(val_8 > (1E-05f))
            {
                    val_21 = val_20 / val_8;
                val_22 = val_6 / val_8;
            }
            else
            {
                    val_21 = mem[mem[536895699]];
                val_21 = mem[536895699];
                val_22 = mem[mem[536895699] + 4];
                val_22 = mem[536895699] + 4;
            }
            
            UnityEngine.UI.Graphic val_10 = this.graphic;
            Coffee.UIExtensions.Matrix2x3 val_11 = new Coffee.UIExtensions.Matrix2x3(rect:  new UnityEngine.Rect() {m_XMin = val_4.m_XMin, m_YMin = val_4.m_YMin, m_Width = val_4.m_Width, m_Height = val_4.m_Height}, cos:  val_21, sin:  val_22);
            if(vh.currentVertCount < 1)
            {
                    return;
            }
            
            val_20 = 27357160;
            label_19:
            vh.PopulateUIVertex(vertex:  new UnityEngine.UIVertex() {position = new UnityEngine.Vector3() {x = 0f, y = 0f, z = 0f}, normal = new UnityEngine.Vector3() {x = 0f, y = 0f, z = 0f}, tangent = new UnityEngine.Vector4() {x = 0f, y = 0f, z = 0f, w = 0f}, color = new UnityEngine.Color32(), uv0 = new UnityEngine.Vector4() {x = 0f, y = 0f, z = 0f, w = 0f}, uv1 = new UnityEngine.Vector4() {x = 0f, y = 0f, z = 0f, w = 0f}, uv2 = new UnityEngine.Vector4() {x = 0f, y = 0f, z = 0f, w = 0f}, uv3 = new UnityEngine.Vector4() {x = 0f, y = 0f, z = 0f, w = 0f}}, i:  0);
            if(0 == 0)
            {
                goto label_14;
            }
            
            val_23 = 536894795;
            if(mem[536895019] == 0)
            {
                    val_23 = 536894795;
            }
            
            var val_21 = mem[536894979];
            if((0 & 3) >= (mem[536894979] + 24))
            {
                goto label_17;
            }
            
            val_21 = val_21 + (((0 & 3)) << 3);
            val_24 = mem[(mem[536894979] + ((0 & 3)) << 3) + 32 + 4];
            val_24 = (mem[536894979] + ((0 & 3)) << 3) + 32 + 4;
            goto label_18;
            label_14:
            val_24 = 0f;
            label_18:
            UnityEngine.Vector2 val_14 = Coffee.UIExtensions.Matrix2x3.op_Multiply(m:  new Coffee.UIExtensions.Matrix2x3() {m00 = val_11.m00, m11 = val_11.m11}, v:  new UnityEngine.Vector2());
            val_22 = Packer.ToFloat(x:  0f, y:  0f);
            float val_16 = Packer.ToFloat(x:  val_24, y:  this.GetNormalizedIndex(target:  this));
            vh.SetUIVertex(vertex:  new UnityEngine.UIVertex() {position = new UnityEngine.Vector3(), normal = new UnityEngine.Vector3(), tangent = new UnityEngine.Vector4(), color = new UnityEngine.Color32(), uv0 = new UnityEngine.Vector4(), uv1 = new UnityEngine.Vector4(), uv2 = new UnityEngine.Vector4(), uv3 = new UnityEngine.Vector4()}, i:  0);
            val_19 = 0 + 1;
            if(val_19 < vh.currentVertCount)
            {
                goto label_19;
            }
            
            return;
            label_17:
        }
        public void Play()
        {
            this._player.Play(callback:  0);
        }
        public void Stop()
        {
            this._player.Stop();
        }
        protected override void SetDirty()
        {
            float val_13;
            this.RegisterMaterial(mat:  this.targetGraphic);
            this.SetData(target:  this, channelId:  0, value:  this.m_EffectFactor);
            this.SetData(target:  this, channelId:  1, value:  this.m_Width);
            this.SetData(target:  this, channelId:  2, value:  this.m_Softness);
            this.SetData(target:  this, channelId:  3, value:  this.m_Brightness);
            this.SetData(target:  this, channelId:  4, value:  this.m_Gloss);
            val_13 = this._lastRotation;
            float val_15 = 1E-06f;
            float val_13 = System.Math.Abs(val_13);
            float val_14 = System.Math.Abs(this.m_Rotation);
            val_15 = ((val_13 > val_14) ? (val_13) : (val_14)) * val_15;
            float val_16 = 8f;
            val_16 = mem[536889545] * val_16;
            float val_4 = (val_15 > val_16) ? (val_15) : (val_16);
            if((this.m_Rotation ?? val_13) < 0)
            {
                    return;
            }
            
            if((UnityEngine.Object.op_Implicit(exists:  this.targetGraphic)) == false)
            {
                    return;
            }
            
            this._lastRotation = this.m_Rotation;
            UnityEngine.UI.Graphic val_7 = this.targetGraphic;
            val_13 = ???;
            goto typeof(UnityEngine.UI.Graphic).__il2cppRuntimeField_2F8;
        }
        private Coffee.UIExtensions.EffectPlayer get__player()
        {
            Coffee.UIExtensions.EffectPlayer val_2 = this.m_Player;
            if(val_2 != null)
            {
                    return val_2;
            }
            
            Coffee.UIExtensions.EffectPlayer val_1 = 536885475;
            val_2 = val_1;
            val_1 = new Coffee.UIExtensions.EffectPlayer();
            this.m_Player = val_2;
            return val_2;
        }
        public UIShiny()
        {
            this.m_Width = 0.25f;
            this.m_Softness = 1;
            this.m_Gloss = 1f;
            this.m_Duration = 1;
            if(mem[536895019] != 0)
            {
                    return;
            }
        
        }
        private static UIShiny()
        {
            Coffee.UIExtensions.ParameterTexture val_1 = 536890543;
            val_1 = new Coffee.UIExtensions.ParameterTexture(channels:  8, instanceLimit:  128, propertyName:  -1610600767);
            mem2[0] = val_1;
            throw new NullReferenceException();
        }
        private void <OnEnable>b__62_0(float f)
        {
            this.effectFactor = f;
        }
    
    }

}
